<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt" %>
<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>

<html>
  <head>
    <base href="<%=basePath%>">
    
    <title>My JSP 'orderView.jsp' starting page</title>
    
	<meta http-equiv="pragma" content="no-cache">
	<meta http-equiv="cache-control" content="no-cache">
	<meta http-equiv="expires" content="0">    
	<meta http-equiv="keywords" content="keyword1,keyword2,keyword3">
	<meta http-equiv="description" content="This is my page">
	<script type="application/x-javascript"> addEventListener("load", function() { setTimeout(hideURLbar, 0); }, false); function hideURLbar(){ window.scrollTo(0,1); } </script>
	<!-- //Custom Theme files -->
	<link href="shop-css/bootstrap.css" type="text/css" rel="stylesheet" media="all">
	<link href="shop-css/style.css" type="text/css" rel="stylesheet" media="all">
	<!-- js -->
	<script src="shop-js/jquery.min.js"></script>
	<script type="text/javascript" src="shop-js/bootstrap-3.1.1.min.js"></script>
	<!-- //js -->
	<!-- cart -->
	<script src="shop-js/simpleCart.min.js"> </script>
	<!-- cart -->

  </head>
    <script type="text/javascript">
    function showconfirmDialog(){
      if(${requestScope.msg eq null }){
      	
      }else
      	confirm("${requestScope.msg}")
      	
    }
</script>
  <body onload="showconfirmDialog()">
  <!--header-->
	<div class="header">
		<div class="container">
			<nav class="navbar navbar-default" role="navigation">
				<div class="navbar-header">
					<button type="button" class="navbar-toggle" data-toggle="collapse" data-target="#bs-example-navbar-collapse-1">
						<span class="sr-only"></span>
						<span class="icon-bar"></span>
						<span class="icon-bar"></span>
						<span class="icon-bar"></span>
					</button>
					<h1 class="navbar-brand"><a href="shop.jsp">总店订餐系统</a></h1>
				</div>
				<!--navbar-header-->
				<div class="collapse navbar-collapse" id="bs-example-navbar-collapse-1">
					<ul class="nav navbar-nav">
						<li><a href="shop.jsp" class="active">首页</a></li>
						<li><a href="AllGoods_Servlet" class="dropdown-toggle">订餐</a></li>
						<li><a href="ToOrderView_Servlet" class="dropdown-toggle">我的订单</a></li>
								
					</ul> 
					<!--/.navbar-collapse-->
				</div>
				<!--//navbar-header-->
			</nav>
			<div class="header-info">
				<div class="header-right login">
					<span class="glyphicon glyphicon-user" aria-hidden="true"></span>
					<div id="loginBox">  
						
						<c:if test="${sessionScope.IsLogin eq 'Y'}">
						<form id="loginForm">
							<fieldset id="body">
								<fieldset>
									<label for="email">当前用户：${sessionScope.UserName}</label>
								</fieldset>
							</fieldset>
							<span><a href="Logout_Servlet">注销登录</a></span></p>
						</form>
						</c:if>
						
						<c:if test="${sessionScope.IsLogin eq 'N' || sessionScope.IsLogin eq null}">
						<form id="loginForm" method="post" action="Login_Servlet">
							<fieldset id="body">
								<fieldset>
									<label for="email">手机号</label>
									<input type="text" name="phone" id="email">
								</fieldset>
								<fieldset>
									<label for="password">密码</label>
									<input type="password" name="password" id="password">
								</fieldset>
								<input type="submit" id="login" value="登   录">
								<label for="checkbox"><input type="checkbox" id="checkbox"> <i>记住我</i></label>
							</fieldset>
							<p>新用户 ? <a class="sign" href="register.jsp">注册</a> <span><a href="res.jsp">忘记密码</a></span></p>
						</form>
						</c:if>
					</div>
				</div>
				<div class="header-right cart">
					<span class="glyphicon glyphicon-shopping-cart" aria-hidden="true"></span>
					<c:if test="${sessionScope.IsLogin eq 'Y'}">
					<div class="cart-box">
						<h4><a href="checkout.html">
							<span class="simpleCart_total"> ￥0.00 </span> (<span id="simpleCart_quantity" class="simpleCart_quantity"> 0 </span>) 
						</a></h4>
						<p><a href="EmptyCart_Servlet" class="simpleCart_empty">清空 购物车</a></p>
						<p><a href="DoCart_Servlet" class="simpleCart_empty">结算 购物车</a></p>
						<div class="clearfix"> </div>
					</div>
					</c:if>
				</div>
				<div class="clearfix"> </div>
			</div>
			<div class="clearfix"> </div>
		</div>
	</div>
	<!--//header-->
	<div class="container">
		<h2>订单</h2>
		<table width="100%" height="100%" border="1" cellspacing="0" cellpadding="0">
			<tr>
				<td colspan="4" align="center" valign="middle">
					订单
				</td>
			</tr>	
			<tr>
				<td align="center" valign="middle">菜品名</td><td align="center" valign="middle">数量</td><td align="center" valign="middle">单价</td><td align="center" valign="middle">总价</td>
				
			</tr>	
			<c:forEach items="${sessionScope.order}" var="cart" varStatus="id">
			<tr>
				<td align="center" valign="middle">${cart.name }</td><td align="center" valign="middle">${cart.num }</td><td align="center" valign="middle">${cart.price }</td><td align="center" valign="middle">${cart.total }</td>
			</tr>
			</c:forEach>
			<tr>
				<td colspan="2" align="center" valign="middle">订餐用户：</td><td colspan="2" align="center" valign="middle">${sessionScope.UserName}</td>
			</tr>
			<tr>
				<td colspan="4" align="center" valign="middle">订单总价</td>
			</tr>
			<tr>
				<td colspan="4" align="center" valign="middle">￥${requestScope.allTotal}</td>
			</tr>
		</table>
	</div>
	
	<div class="order">
		<input id="input" type="button" value="返回购物" onclick="window.location.href='shop.jsp'">
	</div>
		
	<div class="footer-bottom">
		<div class="container">
			<p>© 长江师范学院||软件服务与外包1班||   徐瑜小组</p>
		</div>
	</div>
  </body>
</html>
